package com.tg.service.ribbon;

import com.tg.contract.dto.RibbonMessage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.SecureRandom;

@SpringBootApplication
@EnableDiscoveryClient
@RestController
public class RibbonServer {

    public static void main(String[] args) {
        SpringApplication.run(RibbonServer.class, args);
    }

    @GetMapping("/ribbonAccept")
    private RibbonMessage ribbonAccept(String id) {
        RibbonMessage msg = new RibbonMessage();
        msg.setName("tgor" + new SecureRandom().nextInt(99));
        msg.setId(id);
        System.out.println(msg);
        return msg;
    }
}
